//
//  MQSettingMainViewController.m
//  MQ
//
//  Created by lanou on 15/10/26.
//  Copyright © 2015年 徐永祥. All rights reserved.
//

#import "MQSettingMainViewController.h"
#import "MQSaveTableViewController.h"
#import "JT3DScrollView.h"
@interface MQSettingMainViewController ()<UIScrollViewDelegate>

@end

@implementation MQSettingMainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"返回" style:(UIBarButtonItemStyleBordered) target:self action:@selector(didClickReturn:)];
     [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"daohanglan"] forBarMetrics:UIBarMetricsDefault];
    self.navigationItem.title = @"图片收藏";
    self.view.backgroundColor = [UIColor grayColor];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

    UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.view.bounds];
    [imageView setImage:[UIImage imageNamed:@"shoucangbeijing"]];
    [self.view addSubview:imageView];
    
    JT3DScrollView *scrollView = [[JT3DScrollView alloc]initWithFrame:self.view.bounds];
    scrollView.contentSize = CGSizeMake(MQWidth*2, MQHeight);
    scrollView.delegate = self;
    UIImageView *imageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(40, MQHeight/6, MQWidth-80, MQHeight/2)];
    imageView1.layer.cornerRadius = 10;
    imageView1.layer.masksToBounds = YES;
    imageView1.tag = 10;
    UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(savePage:)];
    [imageView1 addGestureRecognizer:tap1];
    imageView1.userInteractionEnabled = YES;
    [imageView1 setImage:[UIImage imageNamed:@"videoSave"]];
    [scrollView addSubview:imageView1];
    
    UIImageView *imageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(40+MQWidth, MQHeight/6, MQWidth-80, MQHeight/2)];
    imageView2.layer.cornerRadius = 10;
    imageView2.layer.masksToBounds = YES;
    imageView2.backgroundColor = [UIColor blueColor];
    UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(savePage:)];
    imageView2.tag = 11;
    [imageView2 addGestureRecognizer:tap2];
    imageView2.userInteractionEnabled = YES;
    [imageView2 setImage:[UIImage imageNamed:@"readSave"]];
    [scrollView addSubview:imageView2];
    scrollView.effect = JT3DScrollViewEffectCards;
    
    [self.view addSubview:scrollView];
    
 }


//右上角返回按钮
- (void)didClickReturn:(UIBarButtonItem *)barButton
{
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
//点击进入不同收藏界面
- (void)savePage:(UITapGestureRecognizer *)tap
{
    MQSaveTableViewController *saveVC = [[MQSaveTableViewController alloc]initWithStyle:(UITableViewStylePlain)];
    saveVC.Stag = tap.view.tag;
    [self.navigationController pushViewController:saveVC animated:YES];
}

-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    if (scrollView.contentOffset.x < MQWidth ) {
        self.navigationItem.title = @"图片收藏";
    }
    else
    {
        self.navigationItem.title = @"段子收藏";
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
